package keystore;

import java.rmi.RemoteException;


public class NodeFactory {
	
	private static final long MAX_KEY = (long) Math.pow(2, 32);
	private static final long MIN_KEY = 0;
	
	private INode root = null;
	
	
		
	public NodeFactory() throws RemoteException {
		this.setupNodes();
	}
	
	public void setupNodes() throws RemoteException {
		
		Node root = new Node(1);
		this.root = (INode) root;
		
		Node node2 = new Node(2);
		Node node3 = new Node(3);
		Node node4 = new Node(4);
				
		root. setChildren(node2, node3);
		node2.setChildren(node4, root);
		node3.setChildren(node2, node3);	
		node4.setChildren(node4, root);	


	}
	
	public void searchLeaf(int key, String record) throws RemoteException {
		// initialize start parameters for the root node
		root.sendNodeParameters(key, record, MIN_KEY, MAX_KEY, 1);	
	}

	
}
